<template>
  <div>
    <table border="1">
      <tr>
        <th v-for="(item, index) in tableList" :key="index">{{ item }}</th>
      </tr>
      <tr v-for="(item, index) in dataList" :key="index">
        <td>{{ index + 1 }}</td>
        <td>{{ item.name }}</td>
        <td v-for="(item1, index1) in item.data" :key="index1">
          {{ item1.num }}
        </td>
        <td><button @click="setData(item)">预览</button></td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: "students",
  props: ["dataList", "tableList"],
  methods: {
    setData(data) {
        this.$emit('set-num',data)
    },
  },
};
</script>

<style>
table {
  margin: 0 auto;
}
th {
  padding: 8px 10px;
  font-size: 14px;
}
</style>
